#python 默认继承object类 ，object 是基类

class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def speak(self):
        print(f"{self.name} says {self.age} years old")


class Student(Person):   #单继承 就是子类只继承一个父类
    def study(self):
        print(f"{self.name} study {self.age} years")


p1 = Student("John", 22)
p1.study()
p1.speak()

print(type(p1))

# 子类对象是 子类类型也是父类类型
print(isinstance(p1, Student))
print(isinstance(p1, Person))
print(issubclass(Person, Student))
print(issubclass(Student, Person))
